Skip to content

daqhats128#3

Open
bkav456 wants to merge 21 commits into
PyMoDAQ:mainfrom
bkav456:main
Open

daqhats128#3
bkav456 wants to merge 21 commits into
PyMoDAQ:mainfrom
bkav456:main

Conversation

@bkav456
Copy link
Copy Markdown

@bkav456 bkav456 commented Apr 21, 2024

On a nettoye le code et mis les commentaires pour chaque methodes

Copy link
Copy Markdown
Contributor

@seb5g seb5g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've done a good job, still some things to fix, see below!

Comment thread plugin_info.toml Outdated
@@ -0,0 +1,134 @@
import numpy as np
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have to remove this file

'limits': ['RISING_EDGE', 'FALLING_EDGE', 'ACTIVE_HIGH',
'ACTIVE_LOW']},
{'title': 'External_clock', 'name': 'extclock_mode', 'type': 'bool', 'value': False},
{'title': 'External sampling rate', 'name': 'extclock_rate', 'type': 'int', 'value': 0},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could add here a 'visible': False option and when a user click on extclockmode, the action in the commit settings would be to show the extclock rate:

if param.name() == 'extclock_mode':
    self.settings.child('extclock_rate').setVisible(param.value()) 

{'title': 'External sampling rate', 'name': 'extclock_rate', 'type': 'int', 'value': 0},
{'title': 'Number of samples:', 'name': 'num_sample', 'type': 'int', 'value': 1000, 'min': 0},
{'title': 'Sampling rate :', 'name': 'sampling_rate', 'type': 'int', 'value': 10000, 'min': 0, 'max': 100000},
{'title': 'Range', 'name': 'range', 'type': 'list', 'value': 10, 'limits': [10, 5, 2, 1]},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specify the units : Range (V)

self.list_channel_names = []

def commit_settings(self, param: Parameter):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this empty line, also a docstring should be as this:

def scan_data(self, totalsamples: int, scan_rate: int, name_channel: int):
    """ Short description

    Longer description if needed

    Parameters
    -----------
    ...
    """

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please apply this to all your docstrings (which are already nice by the way!)


self.settings.child('channel_on', 'CH0H').setValue(True)

self.data_signal = self.scan_data(self.settings['num_sample'], self.settings['sampling_rate'],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete lines 280 up to line 288, we should not grab data at this stage

if len(signal) != 0: # Condition to avoid empty data error
self.data_signal = self.get_data(signal, self.num_channels)

self.dte_signal.emit(DataToExport('myplugin', data=[DataFromPlugins(name='Mock1', data=self.data_signal,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace 'myplugin' by a meaningfull name (same for Mock1)

@@ -0,0 +1,31 @@
# Initializing an empty list
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this file for? If nothing anymore, please delete it

@bkav456 bkav456 closed this Apr 27, 2024
@bkav456 bkav456 reopened this Apr 27, 2024
@bkav456 bkav456 closed this Apr 27, 2024
@bkav456 bkav456 reopened this Apr 27, 2024
@bkav456
Copy link
Copy Markdown
Author

bkav456 commented Apr 27, 2024

J'ai corrigé le code. Est ce que vous pouvez le revoir ?

@bkav456 bkav456 requested a review from seb5g April 29, 2024 11:24
Comment thread plugin_info.toml Outdated
[plugin-install]
#packages required for your plugin:
packages-required = ['pymodaq>=4.0.0', 'daqhats']
packages-required = ['pymodaq>=4.0.0', 'picamera2']
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be only one list including all necessary packages, here you created two similar lines...

self.settings.child('extclock_rate').setOpts(visible = param.value())

def scan_data(self, totalsamples: int, scan_rate: int, name_channel: int):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this empty line

return voltage.data

def set_range(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this empty line

self.controller.a_in_range_write(self.range)

def set_mode(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this empty line

self.controller.a_in_mode_write(self.mode)

def set_trigger(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this empty line


"""

global Tmode
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use global variable

"""Terminate the communication protocol"""

def grab_data(self, Naverage=1, **kwargs):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this empty line

projet567 and others added 2 commits April 29, 2024 23:56
@bkav456 bkav456 requested a review from seb5g April 29, 2024 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants